package com.example.lanqiaodemo1;

import java.util.ArrayList;

public class Dog {
    long id;
    String name;
    double price;

    public long getId() { return id; }

    public void setId(long id) { this.id = id; }

    public String getName() { return name; }

    public void setName(String name) { this.name = name; }

    public double getPrice() { return price; }

    public void setPrice(double price) { this.price = price; }

    public Dog(long id, String name, double price) {
        this.id = id;
        this.name = name;
        this.price = price;
    }

    public Dog() {}
    @Override
    public String toString() {
        return "Dog{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                '}';
    }
}

class DogManger {
    public static void main(String[] args) {
        ArrayList<Dog> listDog = new ArrayList<>();
        listDog.add(new Dog(1, "dog1", 22));
        listDog.add(new Dog(2, "dog2", 25));
        listDog.add(new Dog(3, "dog3", 23));

        double sum = 0;
        for (int i = 0; i < listDog.size(); i++) {
            sum += listDog.get(i).getPrice();
            System.out.println(listDog.get(i).getId());
            System.out.println(listDog.get(i).getPrice());
            System.out.println(listDog.get(i).getName());
        }

        System.out.println(sum);
    }
}

